package com.tinyseed.emcp.api.basicdata.model;

import com.tinyseed.emcp.api.basicdata.domain.Industry;
import com.tinyseed.emcp.api.basicdata.domain.convert.DTOConvert;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * Industry
 *
 * @author tinyCode
 * @date 2019-11-20 17:28:43
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class IndustryOutputDTO implements Serializable {

    /**
     * 唯一主键
     */
    private Long id;

    /**
     * 行业CODE
     */
    private String industryCode;

    /**
     * 行业名称
     */
    private String industryName;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建时间
     */
    private Timestamp createTime;

    /**
     * 最后修改时间
     */
    private Timestamp modifyTime;

    /**
     * 创建人
     */
    private String creator;

    /**
     * 最后操作人
     */
    private String modifier;

    public Industry convertToIndustry() {
        IndustryOutputDTOConvert convert = new IndustryOutputDTOConvert();
        Industry result = convert.convert(this);
        return result;
    }

    private static class IndustryOutputDTOConvert implements DTOConvert<IndustryOutputDTO, Industry> {

        @Override
        public Industry convert(IndustryOutputDTO industryOutputDTO) {
            Industry industry = new Industry();
            BeanUtils.copyProperties(industryOutputDTO, industry);
            return industry;
        }
    }

}
